package com.hellogood.yaohuo.server.mgr;

import java.util.List;

import com.hellogood.yaohuo.server.dao.factory.DAOFactory;
import com.hellogood.yaohuo.shared.entity.Goods;

public class GoodsMgr {

	public List<Goods> getGoods() {
		return DAOFactory.getInstance().createGoodsDAO().getGoods();
	}

	public List<Goods> getGoodsByCode(String code) {
		if (code.endsWith("/")) {
			code = code.replaceAll("/", "");
			return DAOFactory.getInstance().createGoodsDAO().getGoodsByPluMN(code);
		} else {
			return DAOFactory.getInstance().createGoodsDAO().getGoodsByPluCodeOrBarCode(code);
		}
	}
}
